************************************
Workbook Labs 11 - 22 (12)
************************************

*******************************************************************************
Lab # 1 - Configuring the Base Topology - eBGP , iBGP and IGP as an Underlap
*******************************************************************************

+++++++++++++++++++++++++++++++++++++++++++
1. eBGP between AS 100 & AS 12
+++++++++++++++++++++++++++++++++++++++++++

-----
R10
-----

router bgp 100
 network 1.10.1.0 mask 255.255.255.0
 network 1.10.2.0 mask 255.255.255.0
 neighbor 192.1.110.1 remote-as 12
 neighbor 192.1.120.2 remote-as 12

-----
R1
-----

router bgp 12
 network 1.1.1.0 mask 255.255.255.0
 network 1.1.2.0 mask 255.255.255.0
 neighbor 192.1.110.10 remote-as 100

-----
R2
-----

router bgp 12
 network 1.2.1.0 mask 255.255.255.0
 network 1.2.2.0 mask 255.255.255.0
 neighbor 192.1.120.10 remote-as 100

+++++++++++++++++++++++++++++++++++++++++++
2. iBGP within AS 12
+++++++++++++++++++++++++++++++++++++++++++

-----
R1
-----

Interface Loopback 10
 ip address 192.168.1.1 255.255.255.255
!
router eigrp 12
 network 192.168.12.0
 network 192.168.1.0
!
router bgp 12
 neighbor 192.168.1.2 remote-as 12
 neighbor 192.168.1.2 update-source Loopback10
 neighbor 192.168.1.2 next-hop-self

-----
R2
-----

Interface Loopback 10
 ip address 192.168.1.2 255.255.255.255
!
router eigrp 12
 network 192.168.12.0
 network 192.168.1.0
!
router bgp 12
 neighbor 192.168.1.1 remote-as 12
 neighbor 192.168.1.1 update-source Loopback10
 neighbor 192.168.1.1 next-hop-self

+++++++++++++++++++++++++++++++++++++++++++
3. eBGP between AS 1000 & AS 12
+++++++++++++++++++++++++++++++++++++++++++

-----
R1
-----

router bgp 12
 neighbor 192.1.13.3 remote-as 1000

-----
R2
-----

router bgp 12
 neighbor 192.1.24.4 remote-as 1000

-----
R3
-----

router bgp 1000
 network 1.3.1.0 mask 255.255.255.0
 network 1.3.2.0 mask 255.255.255.0
 neighbor 192.1.13.1 remote-as 12

-----
R4
-----

router bgp 1000
 network 1.4.1.0 mask 255.255.255.0
 network 1.4.2.0 mask 255.255.255.0
 neighbor 192.1.24.2 remote-as 12

+++++++++++++++++++++++++++++++++++++++++++
4. iBGP within AS 1000
+++++++++++++++++++++++++++++++++++++++++++

-----
R3
-----

router bgp 1000
 neighbor 192.168.34.4 remote-as 1000
 neighbor 192.168.34.4 next-hop-self
 neighbor 192.168.34.4 route-reflector-client
 neighbor 192.168.35.5 remote-as 1000
 neighbor 192.168.35.5 next-hop-self
 neighbor 192.168.35.5 route-reflector-client

-----
R4
-----

router bgp 1000
 neighbor 192.168.34.3 remote-as 1000
 neighbor 192.168.34.3 next-hop-self

-----
R5
-----

router bgp 1000
 network 1.5.1.0 mask 255.255.255.0
 network 1.5.2.0 mask 255.255.255.0
 neighbor 192.168.35.3 remote-as 1000
 neighbor 192.168.35.3 next-hop-self

+++++++++++++++++++++++++++++++++++++++++++
5. Internal IGP in AS 1000 between R3 & R6
+++++++++++++++++++++++++++++++++++++++++++

-----
R3
-----

router ospf 1
 router-id 0.0.0.3
 network 192.168.36.0 0.0.0.255 area 0
 redistribute bgp 1000
!
router bgp 1000
 redistribute ospf 1

-----
R6
-----

router ospf 1
 router-id 0.0.0.6
 network 192.168.36.0 0.0.0.255 area 0
 network 1.6.0.0 0.0.255.255 area 0

+++++++++++++++++++++++++++++++++++++++++++
6. eBGP between AS 1000 & AS 2000
+++++++++++++++++++++++++++++++++++++++++++

-----
R4
-----

router bgp 1000
 neighbor 192.1.47.7 remote-as 2000
 neighbor 192.1.48.8 remote-as 2000

-----
R7
-----

router bgp 2000
 network 1.7.1.0 mask 255.255.255.0
 network 1.7.2.0 mask 255.255.255.0
 neighbor 192.1.47.4 remote-as 1000

-----
R8
-----

router bgp 2000
 network 1.8.1.0 mask 255.255.255.0
 network 1.8.2.0 mask 255.255.255.0
 neighbor 192.1.48.4 remote-as 1000

+++++++++++++++++++++++++++++++++++++++++++
7. iBGP within AS 2000
+++++++++++++++++++++++++++++++++++++++++++

-----
R7
-----

router eigrp 2000
 network 192.168.79.0
 network 10.7.7.0 0.0.0.255
!
router bgp 2000
 neighbor 10.9.9.9 remote-as 2000
 neighbor 10.9.9.9 update-source Loopback10
 neighbor 10.9.9.9 next-hop-self

-----
R8
-----

router eigrp 2000
 network 192.168.89.0
 network 10.8.8.0 0.0.0.255
!
router bgp 2000
 neighbor 10.9.9.9 remote-as 2000
 neighbor 10.9.9.9 update-source Loopback10
 neighbor 10.9.9.9 next-hop-self

-----
R9
-----

router eigrp 2000
 network 192.168.79.0
 network 192.168.89.0
 network 10.9.9.0 0.0.0.255
!
router bgp 2000
 network 1.9.1.0 mask 255.255.255.0
 network 1.9.2.0 mask 255.255.255.0
 neighbor IBGP peer-group
 neighbor IBGP remote-as 2000
 neighbor IBGP update-source Loopback10
 neighbor IBGP next-hop-self
 neighbor IBGP route-reflector-client
 neighbor 10.7.7.7 peer-group IBGP
 neighbor 10.8.8.8 peer-group IBGP

+++++++++++++++++++++++++++++++++++++++++++
8. eBGP between AS 110 & AS 2000
+++++++++++++++++++++++++++++++++++++++++++

-----
R9
-----

router bgp 2000
 neighbor 192.1.190.11 remote-as 110

-----
R11
-----

router bgp 110
 network 1.11.1.0 mask 255.255.255.0
 network 1.11.2.0 mask 255.255.255.0
 neighbor 192.1.190.9 remote-as 2000

*******************************************************************************
Lab # 2 - Redistributing IBGP into IGP
*******************************************************************************

-----
R3
-----

router bgp 1000
 bgp redistribute-internal

*******************************************************************************
Lab # 3 - Changing the Next-hop for reflected routes
*******************************************************************************

-----
R3
-----

router bgp 1000
 neighbor 192.168.34.4 next-hop-self all
 neighbor 192.168.35.5 next-hop-self all

*******************************************************************************
Lab # 4 - Load Balancing (ECMP) with BGP
*******************************************************************************

+++++++++++++++++++++++++++++++++++++++++++++++++
ECMP between AS 100 & AS 12
+++++++++++++++++++++++++++++++++++++++++++++++++

-----
R10
-----

router bgp 100
 maximum-paths 2

+++++++++++++++++++++++++++++++++++++++++++++++++
ECMP - iBGP Paths
+++++++++++++++++++++++++++++++++++++++++++++++++

-----
R9
-----

router bgp 100
 maximum-paths ibgp 2

+++++++++++++++++++++++++++++++++++++++++++++++++
ECMP - with eBGP & iBGP Paths
+++++++++++++++++++++++++++++++++++++++++++++++++

-----
R3
-----

router bgp 100
 maximum-paths ibgp 2

*******************************************************************************
Lab # 5 - Attributes - Local Preference
*******************************************************************************

Note: 

-> If you would like to control OUTBOUND TRAFFIC, set the attribute on the INCOMING ROUTE

-> If you would like to control INBOUND TRAFFIC, set the attribute on the OUTGOING ROUTE

Local Preference:
-----------------

-> It is a Standard Attribute.
-> It is used to control OUTBOUND Traffic leaving your AS. (Traffic meant for Remote Networks)
-> It is a number. 
-> Higher the Better.
-> The default Local Preference is 100.
-> It is set on the INCOMING Route.

Requirement:

AS 2000 wants to use the R4-R7 link as the preferred exit towards routes learnt from AS 1000.

-----
R7
-----

route-map SETLP
 set local-preference 111
!
router bgp 2000
 neighbor 192.1.47.4 route-map SETLP in

*******************************************************************************
Lab # 6 - Attributes - MED (Metric)
*******************************************************************************

MED:
-----------------

-> It is a Standard Attribute.
-> It is used to control INBOUND Traffic entering your AS. (Traffic meant for Routes Propagated by you)
-> It is a number like a Cost 
-> Lower the Better.
-> The default MED/Metric is 0.
-> It is set on the OUTGOING Route(s).

Requirement:

AS 2000 wants to use the R4-R8 link as the preferred entry from AS 1000.

-----
R7
-----

route-map SETMED
 set metric 77
!
router bgp 2000
 neighbor 192.1.47.4 route-map SETMED out

*******************************************************************************
Lab # 7 - Attributes - WEIGHT *******************************************************************************

WEIGHT:
-----------------

-> It is a Cisco Prop.
-> It is used to control OUTBOUND Traffic leaving your Router. It is local to the router. 
-> It is a number.
-> Higher the Better.
-> The default Weight is 0 for any remote route.
-> It is set on the Incoming Route(s).

Requirement:

AS 2000 wants to use the R4-R8 link as the preferred entry from AS 1000.

-----
R7
-----

route-map SETWT
 set metric 88
!
router bgp 2000
 neighbor 192.1.47.4 route-map SETWT in

*******************************************************************************
Lab # 8 - Attributes - AS PATH
*******************************************************************************

AS Path:
-----------------

-> It is a Standard Attribute
-> It is used to control INBOUND & OUTBOUND Traffic. 
-> It is like a Hop Count (AS-Hop Count).
-> Shorter the Better.
-> It is set on the Incoming Route(s) to control Outbound Traffic. Set the AS-Path prepend to the Neighbor AS.
-> It is set on the Outgoing Route(s) to control Inbound Traffic. Set the AS-Path prepend to the Local AS.

-----
R7
-----

no route-map SETMED
no route-map SETLP
!
router bgp 2000
 no  neighbor 192.1.47.4 route-map SETLP in
 no  neighbor 192.1.47.4 route-map SETMED out

-----
R8
-----

no route-map SETWT
!
router bgp 2000
 no neighbor 192.1.48.4 route-map SETWT in

Requirement:

AS 2000 wants to use the R4-R7 link as the preferred entry from AS 1000. AS 2000 wants to use the R4-R8 link as the preferred exit towards routes learnt from AS 1000.

++++++++++++++++++++++++++++++++++
Control Inbound via R7
++++++++++++++++++++++++++++++++++

-----
R8
-----

route-map SETAS
 set as-path prepend 2000
!
router bgp 2000
 neighbor 192.1.48.4 route-map SETAS out

++++++++++++++++++++++++++++++++++
Control Outbound via R8
++++++++++++++++++++++++++++++++++

-----
R7
-----

route-map SETAS
 set as-path prepend 1000
!
router bgp 2000
 neighbor 192.1.47.4 route-map SETAS in

Weight -> Local Preference -> AS-Path -> MED

*******************************************************************************
Lab # 9 - Attributes - No-Export
*******************************************************************************

Requirement:

AS 110 routes should not be propagated beyond AS 2000.

-----
R11
-----

route-map ABC
 set community no-export
!
router bgp 110
 neighbor 192.1.190.9 route-map ABC out

*******************************************************************************
Lab # 10 - Attributes - No-Advertise
*******************************************************************************

Requirement:

AS 110 routes should not be propagated beyond R9.

-----
R11
-----

route-map ABC
 no set community no-export
 set community no-advertise

*******************************************************************************
Lab # 11 - Conditional Advertisement
*******************************************************************************

Requirement:

R8 should advertise the 1.7.0.0/16, 1.8.0.0/16 & 1.9.0.0/16 routes in case R7 is not reachable.

-----
R7
-----

interface loopback 99
 ip address 192.168.7.7 255.255.255.255
!
router bgp 2000
 network 192.168.7.7 mask 255.255.255.255

-----
R8
-----

access-list 1 permit 1.7.0.0 0.0.255.255
access-list 1 permit 1.8.0.0 0.0.255.255
access-list 1 permit 1.9.0.0 0.0.255.255
!
access-list 2 permit 192.168.7.7 0.0.0.0
!
route-map R7-LINK
 match ip address 2
!
route-map NETS
 match ip address 1
!
router bgp 2000
 neighbor 192.1.48.4 advertise-map NETS non-exist-map R7-LINK


